package com.han.walkman.dao;

import com.han.walkman.entity.VisitingPlanEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @Author: Hanjiafeng
 * @Date: 2020/5/15
 * @Desc:
 */
public interface VisitingPlanDao extends JpaRepository<VisitingPlanEntity, Integer> {

    /**
     * 查询今天之前的拜访计划
     *
     * @return 今天之前的拜访计划list
     */
    @Query(value = "SELECT * FROM t_visiting_plan WHERE TO_DAYS(NOW()) - TO_DAYS(book_date) > 0", nativeQuery = true)
    List<VisitingPlanEntity> findAllBeforeDate();
}
